Use case: ICACHE remap region successful ¶
This use case shows how to configure and enable a remapping region using ICACHE, comparing HAL1 and HAL2.
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_ICACHE_Disable();
HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY);
/* Remap SRAM memory */
region_config.TrafficRoute = ICACHE_MASTER2_PORT;
region_config.OutputBurstType = ICACHE_OUTPUT_BURST_INCR;
region_config.Size = ICACHE_REGIONSIZE_2MB;
region_config.BaseAddress = 0x10000000;
region_config.RemapAddress = 0x60000000;
/* Enable the remapped region */
if (HAL_ICACHE_EnableRemapRegion(ICACHE_REGION_1, ®ion_config) != HAL_OK)
{
Error_Handler();
}
/* Enable the Instruction and Data Cache */
HAL_ICACHE_Enable();
|
HAL_ICACHE_Init(&hicache1, HAL_ICACHE1);
HAL_ICACHE_SetAssociativityMode(&hicache1, HAL_ICACHE_ASSOCIATIVITY_1WAY);
/* Remap SRAM memory */
region_config.master_port = HAL_ICACHE_MASTER2_PORT;
region_config.output_burst = HAL_ICACHE_BURST_INCR;
region_config.size = HAL_ICACHE_REGION_SIZE_2MBYTES;
region_config.base_address = 0x10000000;
region_config.remap_address = 0x60000000;
/* Configure the remapped region */
if (HAL_ICACHE_SetConfigRemapRegion(&hicache1, HAL_ICACHE_REGION_1, ®ion_config) != HAL_OK)
{
Error_Handler();
}
if (HAL_ICACHE_EnableRemapRegion(&hicache1, HAL_ICACHE_REGION_1) != HAL_OK)
{
Error_Handler();
}
/* Start the Instruction Cache */
HAL_ICACHE_Start(&hicache1, HAL_ICACHE_IT_NONE);
|
Key changes ¶
HAL2 introduces an explicit configuration step for remap regions (
HAL_ICACHE_SetConfigRemapRegion()), separate from enabling the region.HAL2 uses a handle-based flow (
HAL_ICACHE_Init()+HAL_ICACHE_Start()), whereas HAL1 uses global enable/disable APIs.Several enums/fields are renamed in HAL2 (for example, region size and master port names).

